home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / A-Z / G / GridViews / Row Selection in Grid Views / TRowSelectGridView.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  2.3 KB  |  77 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // UViewSkeleton.cp
  3. // Copyright © 1991-96 by Apple Computer, Inc. All rights reserved. 
  4. //----------------------------------------------------------------------------------------
  5.  
  6. #ifndef __TRowSelectGridView__
  7. #include "TRowSelectGridView.h"
  8. #endif
  9.     
  10. #undef Inherited
  11.  
  12. //========================================================================================
  13. // Global Initialization Procedure
  14. //========================================================================================
  15. //----------------------------------------------------------------------------------------
  16. // InitTRowSelectGridView: 
  17. //----------------------------------------------------------------------------------------
  18. #pragma segment DlgInit
  19.  
  20. void InitTRowSelectGridView()
  21. {
  22.     MA_REGISTER_CLASS(TRowSelectGridView);
  23. }
  24.  
  25. //========================================================================================
  26. // CLASS TRowSelectGridView
  27. //========================================================================================
  28. #undef Inherited
  29. #define Inherited TTextGridView
  30.  
  31. #pragma segment AOpen
  32. MA_DEFINE_CLASS_M1(TRowSelectGridView, TTextGridView);
  33.  
  34. TRowSelectGridView::TRowSelectGridView()
  35. {
  36. }
  37.  
  38. TRowSelectGridView::~TRowSelectGridView()
  39. {
  40. }
  41.  
  42. #pragma segment GVRes
  43. void TRowSelectGridView::GetText(GridCell aCell, CStr255& aString)
  44. {
  45.     CStr255 numStr;
  46.     NumToString(aCell.h, aString);
  47.     aString += ", ";
  48.     NumToString(aCell.v, numStr);
  49.     aString += numStr;
  50. }
  51.  
  52.  
  53. //----------------------------------------------------------------------------------------
  54. // TRowSelectGridView::DoMouseCommand
  55. //----------------------------------------------------------------------------------------
  56. #pragma segment ASelCommand
  57.  
  58. void TRowSelectGridView::DoMouseCommand(VPoint& theMouse,
  59.                                   TToolboxEvent* event,
  60.                                   CPoint /* hysteresis */)    // Override
  61. {
  62.     GridCell aCell;
  63.  
  64.     if ((this->IdentifyPoint(theMouse, aCell) != badChoice)
  65.         && this->CanSelectCell(aCell))
  66.     {
  67.         TRowSelectCommand * aRowSelectCommand = new TRowSelectCommand;
  68.         aRowSelectCommand->IRowSelectCommand(this, theMouse, event->IsShiftKeyPressed(), event->IsCommandKeyPressed());
  69.         this->PostCommand(aRowSelectCommand);
  70.     }
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // End of TRowSelectGridView.cp
  75.  
  76. #pragma segment Inline
  77.